package com.groupbuying.customer.service.impl;

import com.groupbuying.customer.dao.CustomerShopLevelTypeDao;
import com.groupbuying.customer.domain.CustomerShopLevelTypeDO;
import com.groupbuying.customer.pojo.CustomerShopLevelEnum;
import com.groupbuying.customer.service.CustomerShopLevelTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class CustomerShopLevelTypeServiceImpl implements CustomerShopLevelTypeService {
    @Autowired
    private CustomerShopLevelTypeDao customerShopLevelTypeDao;

    @Override
    public CustomerShopLevelTypeDO get(String uuid) {
        return customerShopLevelTypeDao.get(uuid);
    }

    @Override
    public List<CustomerShopLevelTypeDO> list(Map<String, Object> map) {
        return customerShopLevelTypeDao.list(map);
    }

    @Override
    public int count(Map<String, Object> map) {
        return customerShopLevelTypeDao.count(map);
    }

    @Override
    public int save(CustomerShopLevelTypeDO customerShopLevelType) {
        return customerShopLevelTypeDao.save(customerShopLevelType);
    }

    @Override
    public int update(CustomerShopLevelTypeDO customerShopLevelType) {
        return customerShopLevelTypeDao.update(customerShopLevelType);
    }

    @Override
    public int remove(String uuid) {
        return customerShopLevelTypeDao.remove(uuid);
    }

    @Override
    public int batchRemove(String[] uuids) {
        return customerShopLevelTypeDao.batchRemove(uuids);
    }


    @Override
    public Object getUseShopType() {

        Map map = new HashMap();
        map.put("delflag", "1");
        map.put("state", CustomerShopLevelEnum.TYPE_IN_USE);
        List list = this.list(map);
        if (list != null) {
			return list.size()>0 ? list.get(0): null;
        }
        return null;
    }
}
